package Main;

import Controller.Dijkstra_Controller;
import Static.Static;

public class Dijkstra {
    public static String Dijkstra1() {
//        int[][] weight = {{0, 2, 1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
//                {2, 0, 1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
//                {1, 1, 0, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
//                {1, -1, 1, 0, -1, 1, -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1},
//                {-1, 1, -1, -1, 0, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
//                {-1, -1, 2, 1, -1, 0, 3, 2, 5, -1, -1, -1, -1, -1, -1, -1, -1},
//                {-1, -1, -1, -1, 1, 3, 0, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1},
//                {-1, -1, -1, 2, -1, -1, -1, 0, 3, -1, -1, -1, -1, -1, -1, 4, 2},
//                {-1, -1, -1, -1, -1, 5, -1, 3, 0, 1, -1, 3, -1, 2, -1, 3, -1},
//                {-1, -1, -1, -1, -1, -1, 2, -1, 1, 0, 2, 2, -1, -1, -1, -1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 0, 2, 2, -1, -1, -1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, -1, 3, 2, 2, 0, 1, 1, -1, -1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, 1, 0, -1, 1, -1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, 1, -1, 0, 1, 1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, 1, 0, -1, -1},
//                {-1, -1, -1, -1, -1, -1, -1, 4, 8, -1, -1, -1, -1, 1, -1, 0, 3},
//                {-1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, -1, 3, 0}};
        int [][] weight={{0, 20, 10, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
                {20, 0, 10, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
                {10, 10, 0, 10, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
                {10, -1, 10, 0, -1, 1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1},
                {-1, 10, -1, -1, 0, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
                {-1, -1, 20, 10, -1, 0, 30, 20, 50, -1, -1, -1, -1, -1, -1, -1, -1},
                {-1, -1, -1, -1, 10, 30, 0, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1},
                {-1, -1, -1, 20, -1, -1, -1, 0, 30, -1, -1, -1, -1, -1, -1, 40, 20},
                {-1, -1, -1, -1, -1, 50, -1, 30, 0, 10, -1, 30, -1, 20, -1, 30, -1},
                {-1, -1, -1, -1, -1, -1, 20, -1, 10, 0, 20, 20, -1, -1, -1, -1, -1},
                {-1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 0, 20, 20, -1, -1, -1, -1},
                {-1, -1, -1, -1, -1, -1, -1, -1, 30, 20, 20, 0, 10, 1, -1, -1, -1},
                {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 20, 10, 0, -1, 10, -1, -1},
                {-1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, 10, -1, 0, 10, 10, -1},
                {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, 10, 0, -1, -1},
                {-1, -1, -1, -1, -1, -1, -1, 40, 80, -1, -1, -1, -1, 10, -1, 0, 30},
                {-1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, 30, 0}};
//        int [][] weight={ {0,2,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0},
//                {2,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0},
//                {1,1,0,1,0,2,0,0,0,0,0,0,0,0,0,0,0},
//                {1,0,1,0,0,1,0,2,0,0,0,0,0,0,0,0,0},
//                {0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0},
//                {0,0,2,1,0,0,3,2,5,0,0,0,0,0,0,0,0},
//                {0,0,0,0,1,3,0,0,0,2,0,0,0,0,0,0,0},
//                {0,0,0,2,0,2,0,0,3,0,0,0,0,0,0,4,2},
//                {0,0,0,0,0,5,0,3,0,1,0,3,0,2,0,3,0},
//                {0,0,0,0,0,0,2,0,1,0,2,2,0,0,0,0,0},
//                {0,0,0,0,0,0,0,0,0,2,0,2,2,0,0,0,0},
//                {0,0,0,0,0,0,0,0,3,2,2,0,1,1,0,0,0},
//                {0,0,0,0,0,0,0,0,0,0,2,1,0,0,1,0,0},
//                {0,0,0,0,0,0,0,0,2,0,0,1,0,0,1,1,0},
//                {0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0},
//                {0,0,0,0,0,0,0,4,3,0,0,0,0,1,0,0,3},
//                {0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,0}};
        String[] str = {"西大门", "海棠苑", "梧桐苑", "雪松苑", "筠竹苑", "一食堂", "二食堂", "大学生创业中心", "松山湖", "体育馆", "工业中心",
                "乐业楼", "图书馆", "敬业楼", "求真楼", "乐群楼", "南大门"};
        int len = str.length;
        Dijkstra_Controller dijkstra = new Dijkstra_Controller(len);
        //依次让各点当源点，并调用dijkstra函数
        int k, t;
        for (k = 0; k < len; k++)
            if (Static.qidian1.equals(str[k]))
                break;
        for (t = 0; t < len; t++)
            if (Static.zhongdian1.equals(str[t]))
                break;
        int i = k, j = t;
        return dijkstra.dijkstra_Controller(weight, str, i, j);
    }
}
